package com.sirdc.modules.bnp.web;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sirdc.modules.bnp.filter.SysNodeTempleteFilter;
import com.sirdc.modules.bnp.service.SysNodeTempleteService;
import com.sirdc.modules.core.web.JsonBaseController;
import com.sirdc.modules.core.web.model.JqGrid;

import net.huashitong.node.entity.NodeTemplet;

@Controller
@RequestMapping(value = "/bnp/node")
public class SysNodeController extends JsonBaseController {

	@Autowired
	private SysNodeTempleteService service;
	
	@Override
	protected String getView(String view) {
		return "/bnp/node/"+view;
	}
	@RequiresPermissions("bnp:node:query")
	@RequestMapping(method = RequestMethod.GET)
	public String initPage(){
		return getView("query");
	}
	@ResponseBody
	@RequiresPermissions("bnp:node:query")
	@RequestMapping(method = RequestMethod.POST)
	public JqGrid queryNodes(@ModelAttribute SysNodeTempleteFilter filter){
		List<NodeTemplet> list = service.query(filter);
		return coverJqGrid(filter, list);
	}
	@RequestMapping("/filter")
	@RequiresPermissions("bnp:node:query")
	public String filter(@ModelAttribute SysNodeTempleteFilter filter) {
		return getView("filter");
	}
}
 